package com.example.daimaozi;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Build;
import android.view.View;

import androidx.annotation.RequiresApi;

public class HatView extends View {
    public float hatx;
    public float haty;
    public HatView(Context context) {
        super(context);
        hatx=65;
        haty=0;
    }

    @RequiresApi(api = Build.VERSION_CODES.KITKAT)
    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint=new Paint();
        Bitmap bitmap= BitmapFactory.decodeResource(this.getResources(),R.mipmap.timg1);
        canvas.drawBitmap(bitmap,hatx,haty,paint);

        if (bitmap.isRecycled())
           bitmap.recycle();

    }
}
